﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeSphere : OdGeSurface
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeSphere(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGeSphere_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeSphere obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeSphere()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeSphere(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGeSphere() : this(GlobalsPINVOKE.new_OdGeSphere__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSphere(double radius, OdGePoint3d center) : this(GlobalsPINVOKE.new_OdGeSphere__SWIG_1(radius, OdGePoint3d.getCPtr(center)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSphere(double radius, OdGePoint3d center, OdGeVector3d northAxis, OdGeVector3d refAxis, double startAngleU, double endAngleU, double startAngleV, double endAngleV) : this(GlobalsPINVOKE.new_OdGeSphere__SWIG_2(radius, OdGePoint3d.getCPtr(center), OdGeVector3d.getCPtr(northAxis), OdGeVector3d.getCPtr(refAxis), startAngleU, endAngleU, startAngleV, endAngleV), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSphere(OdGeSphere sphere) : this(GlobalsPINVOKE.new_OdGeSphere__SWIG_3(OdGeSphere.getCPtr(sphere)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double radius()
		{
			double result = GlobalsPINVOKE.OdGeSphere_radius(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d center()
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSphere_center(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void getAnglesInU(out double startAngleU, out double endAngleU)
		{
			GlobalsPINVOKE.OdGeSphere_getAnglesInU(this.swigCPtr, out startAngleU, out endAngleU);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getAnglesInV(out double startAngleV, out double endAngleV)
		{
			GlobalsPINVOKE.OdGeSphere_getAnglesInV(this.swigCPtr, out startAngleV, out endAngleV);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeVector3d northAxis()
		{
			OdGeVector3d result = new OdGeVector3d(GlobalsPINVOKE.OdGeSphere_northAxis(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeVector3d refAxis()
		{
			OdGeVector3d result = new OdGeVector3d(GlobalsPINVOKE.OdGeSphere_refAxis(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d northPole()
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSphere_northPole(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d southPole()
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSphere_southPole(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOuterNormal()
		{
			bool result = GlobalsPINVOKE.OdGeSphere_isOuterNormal(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isClosed(OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSphere_isClosed__SWIG_0(this.swigCPtr, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isClosed()
		{
			bool result = GlobalsPINVOKE.OdGeSphere_isClosed__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere setRadius(double radius)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_setRadius(this.swigCPtr, radius), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere setAnglesInU(double startAngleU, double endAngleU)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_setAnglesInU(this.swigCPtr, startAngleU, endAngleU), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere setAnglesInV(double startAngleV, double endAngleV)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_setAnglesInV(this.swigCPtr, startAngleV, endAngleV), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere set(double radius, OdGePoint3d center)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_set__SWIG_0(this.swigCPtr, radius, OdGePoint3d.getCPtr(center)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere set(double radius, OdGePoint3d center, OdGeVector3d northAxis, OdGeVector3d refAxis, double startAngleU, double endAngleU, double startAngleV, double endAngleV)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_set__SWIG_1(this.swigCPtr, radius, OdGePoint3d.getCPtr(center), OdGeVector3d.getCPtr(northAxis), OdGeVector3d.getCPtr(refAxis), startAngleU, endAngleU, startAngleV, endAngleV), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSphere Assign(OdGeSphere sphere)
		{
			OdGeSphere result = new OdGeSphere(GlobalsPINVOKE.OdGeSphere_Assign(this.swigCPtr, OdGeSphere.getCPtr(sphere)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool intersectWith(OdGeLinearEnt3d lineEnt, out int numInt, OdGePoint3d p1, OdGePoint3d p2, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSphere_intersectWith__SWIG_0(this.swigCPtr, OdGeLinearEnt3d.getCPtr(lineEnt), out numInt, OdGePoint3d.getCPtr(p1), OdGePoint3d.getCPtr(p2), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool intersectWith(OdGeLinearEnt3d lineEnt, out int numInt, OdGePoint3d p1, OdGePoint3d p2)
		{
			bool result = GlobalsPINVOKE.OdGeSphere_intersectWith__SWIG_1(this.swigCPtr, OdGeLinearEnt3d.getCPtr(lineEnt), out numInt, OdGePoint3d.getCPtr(p1), OdGePoint3d.getCPtr(p2));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
